import Vue from 'vue'
import App from 'app/views/App.vue'
import router from './router'
import store from './store'

import "@/assets/css/styles.scss";
import "@/common/Common";
import "@/plugins";

import { UserHelper } from '@/common/UserHelper';
import R from "@/common/R";
import AppComponent from "@/App.vue";

import kaiosapp from "app/index";

// if ('serviceWorker' in navigator) {
//     navigator.serviceWorker.register('/service-worker.js', { scope: "./" })
//         .then((registration) => {
//             console.log('Service Worker registered with scope:', registration.scope);
//         })
//         .catch((error) => {
//             console.log('Service Worker registration failed:', error);
//         });
// }

Vue.prototype.$user = new UserHelper();

const vue = new Vue({
    router,
    store,
    render: h => h(App, { scopedSlots: { component: (props) => h(AppComponent) } })
});
Vue.use(kaiosapp, {
    vue,
    res: R,
});


vue.$mount('#app');

declare module "vue/types/vue" {
    interface Vue {
        $R: typeof R;
        $user: UserHelper;
    }
}
